package com.atues.thread.demo01;

public class Test3 extends Thread{
//这里如果继承Thread就不会共享变量，因为他需要每次创建一个新的对象就作为一个线程
    private int i = 10;
    @Override
    public void run() {

        while (true) {
            if(i<=0)break;
            System.out.println(Thread.currentThread().getName()+" i=" + i--);

        }

    }

    public static void main(String[] args) {
        ThreadTest2 thread = new ThreadTest2();
        new Test3().start();
        new Test3().start();
        new Test3().start();
//        new Thread(thread,"小明").start();
//        new Thread(thread, "小蓝").start();
//        new Thread(thread, "小红").start();

    }
}
